/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package wggcth.persistencia.vo;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author deusemar
 */
@Entity
@Table(name = "dados_experimento", catalog = "wggcth", schema = "")
@NamedQueries({@NamedQuery(name = "DadosExperimento.findAll", query = "SELECT d FROM DadosExperimento d"), @NamedQuery(name = "DadosExperimento.findByIdvariavel", query = "SELECT d FROM DadosExperimento d WHERE d.dadosExperimentoPK.idvariavel = :idvariavel"), @NamedQuery(name = "DadosExperimento.findByIdamostra", query = "SELECT d FROM DadosExperimento d WHERE d.dadosExperimentoPK.idamostra = :idamostra"), @NamedQuery(name = "DadosExperimento.findByIdexperimento", query = "SELECT d FROM DadosExperimento d WHERE d.dadosExperimentoPK.idexperimento = :idexperimento"), @NamedQuery(name = "DadosExperimento.findByValor", query = "SELECT d FROM DadosExperimento d WHERE d.valor = :valor")})
public class DadosExperimento implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected DadosExperimentoPK dadosExperimentoPK;
    @Column(name = "VALOR", precision = 15, scale = 6)
    private BigDecimal valor;
    @JoinColumn(name = "IDEXPERIMENTO", referencedColumnName = "IDEXPERIMENTO", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Experimento experimento;
    @JoinColumn(name = "IDAMOSTRA", referencedColumnName = "IDAMOSTRA", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Amostra amostra;
    @JoinColumn(name = "IDVARIAVEL", referencedColumnName = "IDVARIAVEL", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Variavel variavel;

    public DadosExperimento() {
    }

    public DadosExperimento(DadosExperimentoPK dadosExperimentoPK) {
        this.dadosExperimentoPK = dadosExperimentoPK;
    }

    public DadosExperimento(int idvariavel, int idamostra, int idexperimento) {
        this.dadosExperimentoPK = new DadosExperimentoPK(idvariavel, idamostra, idexperimento);
    }

    public DadosExperimentoPK getDadosExperimentoPK() {
        return dadosExperimentoPK;
    }

    public void setDadosExperimentoPK(DadosExperimentoPK dadosExperimentoPK) {
        this.dadosExperimentoPK = dadosExperimentoPK;
    }

    public BigDecimal getValor() {
        return valor;
    }

    public void setValor(BigDecimal valor) {
        this.valor = valor;
    }

    public Experimento getExperimento() {
        return experimento;
    }

    public void setExperimento(Experimento experimento) {
        this.experimento = experimento;
    }

    public Amostra getAmostra() {
        return amostra;
    }

    public void setAmostra(Amostra amostra) {
        this.amostra = amostra;
    }

    public Variavel getVariavel() {
        return variavel;
    }

    public void setVariavel(Variavel variavel) {
        this.variavel = variavel;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (dadosExperimentoPK != null ? dadosExperimentoPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DadosExperimento)) {
            return false;
        }
        DadosExperimento other = (DadosExperimento) object;
        if ((this.dadosExperimentoPK == null && other.dadosExperimentoPK != null) || (this.dadosExperimentoPK != null && !this.dadosExperimentoPK.equals(other.dadosExperimentoPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "wggcth.persistencia.vo.DadosExperimento[dadosExperimentoPK=" + dadosExperimentoPK + "]";
    }

}
